<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Processing.js test of xmlElement removeChildAtIndex()</title>
	<script type="text/javascript" src="../../../processing.js"></script> 

</head>
<body>


	<script id="script" type="application/processing">
XMLElement xml;
void setup() {
  size(200, 200);
  xml = new XMLElement(this, "sites.xml");
  int numSites = xml.getChildCount();
  println("Number of Children before remove: " + numSites);
  xml.removeChildAtIndex(0);
  println("removeChildAtIndex(0)");
  numSites = xml.getChildCount();
  println("Number of Children after remove: " + numSites);
  println("Content:");
  for (int i = 0; i < numSites; i++) {
    XMLElement kid = xml.getChild(i);
    String site = kid.getContent();
    println(site);    
  }
}

	</script>
<h1>XMLElement Test6: removeChildAtIndex()</h1>
<h3>Source</h3><pre>
// The following short XML file called "sites.xml" is parsed 
// in the code below. It must be in the project's "data" directory
//&lt;?xml version="1.0"?&gt; 
// &lt;websites&gt; 
//   &lt;site id="0" url="processing.org"&gt; Processing&lt;/site&gt; 
//   &lt;site id="1" url="mobile.processing.org"&gt; Processing Mobile&lt;/site&gt; 
// &lt;/websites&gt; 

XMLElement xml;
void setup() {
  size(200, 200);
  xml = new XMLElement(this, "sites.xml");
  int numSites = xml.getChildCount();
  println("Number of Children before remove: " + numSites);
  xml.removeChildAtIndex(0);
  println("removeChildAtIndex(0)");
  numSites = xml.getChildCount();
  println("Number of Children after remove: " + numSites);
  println("Content:");
  for (int i = 0; i < numSites; i++) {
    XMLElement kid = xml.getChild(i);
    String site = kid.getContent();
    println(site);    //prints Processing Mobile

  }
}
</pre>
<canvas id="display" style="width:10;height:10;"></canvas>
</body>
</html>

